Page({
  data: {
    listData:[
      {"code":"新型冠状病毒核算检测","text":"实时荧光RT-PCR方法","type":"阴性"},
      {"code":"新型冠状病毒抗体检测","text":"胶体金法","type":""},
      {"code":"采样时间\n2020-12-25","text":"收样时间\n2020-12-25","type":"检测时间\n2020-12-26"},
    ],
    // 滑动比例计算
    slideWidth: '', //滑块宽
    slideLeft: 0, //滑块位置
    totalLength: '', //当前滚动列表总长
    slideShow: false, //滑块是否显示
    slideRatio: '', //滑块比例
    // 渲染数据
    dataList: [{
        name: '第1块',
        src: "/signals/guess1.png",
      },{
        text: '第2块',
        src: "/signals/guess2.png",
      }, {
        text: '第3块',
        src: "/signals/guess3.png",
      },{
        text: '第4块',
        src: "/signals/guess1.png",
      },{
        text: '第5块',
        src: "/signals/guess2.png",
      },{
        text: '第6块',
        src: "/signals/guess3.png",
      }],
    
  },
  onLoad: function () {
    console.log('onLoad') ,
    this.setData({
      windowWidth: systemInfo.windowWidth,
    })
    this.getRatio()
  },
  getRatio() {
    if (this.data.dataList.length < 4) {
      this.setData({
        slideShow: false
      })
    } else {
      var _totalLength = this.data.dataList.length * 173; //分类列表总长度
      this.setData({
        slideWidth: _showLength,
        totalLength: _totalLength,
        slideShow: true,
        slideRatio: _ratio
      })
    }
  },
  //slideLeft动态变化
  getleft(e) {
    this.setData({
      slideLeft: e.detail.scrollLeft * this.data.slideRatio
    })
  }
})


// 接收jf界面的id
// onLoad: function (options) {
//   var id=options.id//接收上一个页面传来的id
//   this.getOne(id)
//   },
//   getOne(id){//以传过来的id参数作为依据在新页面获取对应的数据
//   db.collection("Art").doc(id).get().then(res=>{
//   this.setData({
//     oneData:res.data
//   })
//   })
//   }
